<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Config extends MY_Controller {

	function __construct()
    {
        parent::__construct();
		$this->check_manage_session();//判断用户是否登录
    }
	
	public function index()
	{
	    $data['sidelist'] = $this->admin_model->get_list('channel','','','','sort ASC,id DESC');
		$this->load->view($this -> config->item('system_manage_path').'config',$data);
	}
	
	public function save(){
	    $action_text="保存";
	    $this->load->helper('file');
		$post=$this->input->post();
		
		$read_str=read_file(APPPATH.'/files/config_home.php');
		$read_str=str_replace('#_web_name_#',$post['web_name'],$read_str);
		$read_str=str_replace('#_web_seo_name_#',$post['web_seo_name'],$read_str);
		$read_str=str_replace('#_web_seo_keywords_#',$post['web_seo_keywords'],$read_str);
		$read_str=str_replace('#_web_seo_description_#',$post['web_seo_description'],$read_str);
		$result=write_file(APPPATH.'/config/home.php', $read_str);
		
		if($result){
			$this->success($action_text.'成功',2);
		}else{
			$this->error($action_text.'失败',2);
		}
	}
	
}
